home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Information / CSMP Digest / volume 1 / csmp-v1-112.txt < prev    next >
Encoding:
Text File  |  1994-12-08  |  31.8 KB  |  880 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Fri, 12 Jun 92       Volume 1 : Issue 112
  2.  
  3. Today's Topics:
  4.  
  5.     System 7.1a query...
  6.     InsideMacDA
  7.     Inside Mac...C and Pascal?
  8.     System 7...on the bleeding edge of the finder (bugs?)
  9.     A few questions . . .
  10.     mac programming reference books - any recommendations?
  11.     MPW Jump Table Size Limit
  12.     HELP!  Handle woes
  13.     Totally moronic question concerning color
  14.     Black windows?
  15.  
  16.  
  17. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  18.  
  19. These digests are available (by using FTP, account anonymous, your email
  20. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  21. edu.  This is also the home of the comp.sys.mac.programmer Frequently Asked
  22. Questions list.  The last several issues of the digest are available from
  23. sumex-aim.stanford.edu as well.
  24.  
  25. These digests are also available via email.  Just send a note saying that you
  26. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  27. automatically receive each new digest as it is created.
  28.  
  29. The digest is a collection of articles from the internet newsgroup comp.sys.
  30. mac.programmer.  It is designed for people who read c.s.m.p. semi-regularly
  31. and want an archive of the discussions.  If you don't know what a newsgroup
  32. is, you probably don't have access to it.  Ask your systems administrator(s)
  33. for details.  (This means you can't post questions to the digest.)
  34.  
  35. The articles in these digests are taken directly from comp.sys.mac.programmer.
  36. They are not edited; all articles included in this digest are in their original
  37. posted form.  The only articles that are -not- included in these digests are
  38. those which didn't receive any replies (except those that give information
  39. rather than ask a question).  All replies to each article are concatenated
  40. onto the original article in the order in which they were received.  Article
  41. threads are not added to the digests until the last article added to the
  42. thread is at least one month old (this is to ensure that the thread is dead
  43. before adding it to the digests).
  44.  
  45. Send administrative mail to mkelly@cs.uoregon.edu.
  46.  
  47. -------------------------------------------------------
  48.  
  49. From: klingspo@netlab.cis.brown.edu (Steve Klingsporn)
  50. Subject: System 7.1a query...
  51. Date: 26 Apr 92 03:00:39 GMT
  52. Organization: Brown University
  53.  
  54.  
  55. Does anyone out there (registered developer) have the System 7.1 alpha
  56. seed that supposedly went out to developers?
  57.  
  58. Would someone be so kind as to mail me a floppy (FDHD) copy?
  59. I will reimburse for mailing and disks.
  60.  
  61. Thanks.
  62.  
  63. Steve Klingsporn
  64. 1032 Ashland Avenue
  65. WIlmette, IL  60091
  66.  
  67. +++++++++++++++++++++++++++
  68.  
  69. From: cory@enigami.mv.com (Cory Kempf)
  70. Date: 30 Apr 92 04:50:21 GMT
  71. Organization: EnigamI, Inc., Nashua, NH
  72.  
  73.  
  74. In article <td6cnINNb90@stanley.cis.Brown.EDU> (comp.sys.mac.system,comp.sys.mac.programmer), klingspo@netlab.cis.brown.edu (Steve Klingsporn) writes:
  75. >
  76. >Does anyone out there (registered developer) have the System 7.1 alpha
  77. >seed that supposedly went out to developers?
  78. >
  79. >Would someone be so kind as to mail me a floppy (FDHD) copy?
  80. >I will reimburse for mailing and disks.
  81.  
  82. Well, I am an Apple Partner, and the first I heard of 7.1 alpha was
  83. the MacLeak article.  According to the article, I was supposed to
  84. have received it about two weeks ago.
  85.  
  86. My mailbox has been strangly bare.  Does anyone out there actually
  87. HAVE 7.1?  If you can't comment on it publicly, I would still like
  88. to know about it.
  89.  
  90. thanks,
  91. +C
  92.  
  93.  
  94. - -------------------------------------------------------------
  95. Cory Kempf                    EnigamI, Inc.
  96. cory@enigami.mv.com           ...!decvax!enigami!cory
  97. Microsoft Free and Proud Of It!... 
  98.                            ...Microsoft Products: Just Say no.
  99.  
  100. +++++++++++++++++++++++++++
  101.  
  102. From: amanda@visix.com (Amanda Walker)
  103. Date: 4 May 92 00:04:30 GMT
  104. Organization: Visix Software Inc., Reston, VA
  105.  
  106. cory@enigami.mv.com (Cory Kempf) writes:
  107. > My mailbox has been strangly bare.  Does anyone out there actually
  108. > HAVE 7.1?  If you can't comment on it publicly, I would still like
  109. > to know about it.
  110.  
  111. I have a feeling MacLeak whiffed on this one.  If it went out at all, it was
  112. probably only to selected seed sites.  The latest
  113. unofficial-rumor-from-what-is-usually-a-reliable-source I have heard is that
  114. it's going to be one of things given out on CD at the WWDC.  That'll still be
  115. covered by NDA, though...
  116.  
  117. Whatever the case, I can't imagine anyone being anxious to get an *early* copy
  118. of an alpha release of Mac System Software, unless they're a serious masochist
  119. :).  I'll wait until at least beta before I'll trust my hard disk to it.  I
  120. like my data...
  121.  
  122.  
  123.  
  124. Amanda Walker                        amanda@visix.com
  125. Visix Software Inc.                     +1 800 832 8668
  126. - -- 
  127. "It's not that simple, no matter how you wish it so.  You made public
  128.  statements from a position of false authority; now you're having them shoved
  129.  down your throat.  Welcome to netnews."    --Thomas Maddox
  130.  
  131. +++++++++++++++++++++++++++
  132.  
  133. From: rhessjr@west.darkside.com (Robert Hess)
  134. Date: 7 May 92 22:03:45 GMT
  135. Organization: Independent Consultant
  136.  
  137. In article <1992May4.000430.4703@visix.com>, amanda@visix.com (Amanda Walker) writes:
  138. > I have a feeling MacLeak whiffed on this one.  If it went out at all, it was
  139. > probably only to selected seed sites.  The latest
  140. > unofficial-rumor-from-what-is-usually-a-reliable-source I have heard is that
  141. > it's going to be one of things given out on CD at the WWDC.  That'll still be
  142. > covered by NDA, though...
  143.  
  144. I know of at least two people who (claim to have) received CD's this week.
  145.  
  146. Robert
  147.  
  148. +++++++++++++++++++++++++++
  149.  
  150. From: cory@enigami.mv.com (Cory Kempf)
  151. Date: Thu, 7 May 92 22:35:24 EST
  152. Organization: EnigamI, Inc., Nashua, NH
  153.  
  154.  
  155. In article <1992May4.000430.4703@visix.com> (comp.sys.mac.system,comp.sys.mac.programmer), amanda@visix.com (Amanda Walker) writes:
  156.  
  157. >Whatever the case, I can't imagine anyone being anxious to get an *early* copy
  158. >of an alpha release of Mac System Software, unless they're a serious masochist
  159. >:).  I'll wait until at least beta before I'll trust my hard disk to it.  I
  160. >like my data...
  161.  
  162. Urr.  Unfortunately, I have had the task of developing a SCSI device
  163. driver thrust upon me (belive me, I kicked and screamed, but to no
  164. avail).  At present, it is almost done, but I heard this rumor that
  165. Apple has *FINALLY* gotten around to a rewrite of the SCSI manager
  166. in 7.1... if this is indeed the case, and if that rewrite can give
  167. improved I/O performance on the Quadra, I probably need to do something
  168. to my driver.  Considering the state of the current SCSI docs, I would
  169. be supprised if this turned out to be an easy task -- building it
  170. the first time wasn't.
  171.  
  172. So I want as much time to accomplish this as I can get!
  173.  
  174. +C
  175.  
  176.  
  177. - -------------------------------------------------------------
  178. Cory Kempf                    EnigamI, Inc.
  179. cory@enigami.mv.com           ...!decvax!enigami!cory
  180. Microsoft Free and Proud Of It!... 
  181.                            ...Microsoft Products: Just Say no.
  182.  
  183. ---------------------------
  184.  
  185. From: mj@brando.uwasa.fi (Matti Jakobsson)
  186. Subject: InsideMacDA
  187. Organization: University of Vaasa, Finland
  188. Date: Tue, 5 May 1992 12:26:32 GMT
  189.  
  190. Help. I have tried to order the full version of InsideMacDA 2.0
  191. from Bernard Gallet but my letter was bounced back.
  192. If you know the right address please send it by email.
  193.  
  194. - ---------------------------------------------------------------------
  195. Matti Jakobsson             E-mail: mj@uwasa.fi
  196. University of Vaasa         Fax: +358-61-3248467
  197. Vaasa Finland
  198.  
  199. +++++++++++++++++++++++++++
  200.  
  201. From: EL1@calvacom.fr (Eric_LAPUYADE)
  202. Date: 10 May 92 13:23:08 GMT
  203. Organization: R.C.I CalvaCom
  204.  
  205. Dans <1992May5.122632.14524@uwasa.fi> mj@brando.uwasa.fi (Matti Jakobsson) 
  206.  ecrit:
  207.  
  208. >Help. I have tried to order the full version of InsideMacDA 2.0
  209. >from Bernard Gallet but my letter was bounced back.
  210. >If you know the right address please send it by email.
  211.  
  212. >---------------------------------------------------------------------
  213. >Matti Jakobsson             E-mail: mj@uwasa.fi
  214. >University of Vaasa         Fax: +358-61-3248467
  215. >Vaasa Finland
  216. Bernard has now moved back to France (south). You can email him at
  217. BG75@calvacom.fr.
  218.  
  219.         - Eric -
  220.  
  221. ---------------------------
  222.  
  223. From: chrism@col.hp.com (Chris Magnuson)
  224. Subject: Inside Mac...C and Pascal?
  225. Date: Wed, 6 May 1992 22:34:46 GMT
  226. Organization: HP Colorado Springs Division
  227.  
  228.  I would like to find a Desk accesory or something that tells me the Inside
  229. Macintosh calls in BOTH C and Pascal (or either one a different times).  Is
  230. there something that does this?
  231.  
  232. Thanks,
  233. Chris Magnuson
  234. chrism@col.hp.com
  235. Hewlett-Packard Company
  236.  
  237. +++++++++++++++++++++++++++
  238.  
  239. From: /home/imperial/mes (Mark Stockwell)
  240. Organization: Shell Development Co., Bellaire Research Center, Houston TX
  241. Date: Sun, 10 May 92 19:24:38 GMT
  242.  
  243. I believe that Symantec sell something very like what you're looking for. If 
  244. memory serves, they even call it "Inside Mac DA". 
  245.  
  246.  
  247.  
  248.  
  249. ---------------------------
  250.  
  251. From: alen@crash.cts.com (Alen Shapiro)
  252. Subject: System 7...on the bleeding edge of the finder (bugs?)
  253. Date: 7 May 92 00:49:11 GMT
  254. Organization: Crash TimeSharing, El Cajon, CA
  255.  
  256. ***
  257. WARNING...2-groups posted, modify message header accordingly
  258. ***
  259.  
  260. I'm really getting into this system 7 thang. Have made my code-generator
  261. drag-and-drop with great success (and a lot of guesswork). Made an alias
  262. of the app, placed it (the alias) on the desktop and noted that files
  263. dragged over the alias also activate the app (nice touch...not trivial
  264. for the MacOS to handle (pun intended).
  265.  
  266. I wanted to change the app to be selective about which files would select
  267. it when dragged over. After examining other apps with this feature, changed
  268. the "****" in the bndl resource to "TEXT", rebuilt the desktop and NOTHING
  269. would make it blacken. Rebooted, same result. Next I restored the ****
  270. in the bndl and rebuilt/rebooted. Now the alias-PARENT would blacken but the
  271. alias would not, even though the alias pointed to the correct parent.
  272.  
  273. I fixed this by throwing the alias away and making another, which the finder
  274. immediately recognized as "drag-over-able". Looks like I broke the clever
  275. OS association in the finder for drag-and-drop. Anyone know how?
  276.  
  277. FOLLOW-ON-PROBLEM.
  278. As a result of rebuilding the desktop so many times, another application
  279. document lost its association with its creating application. It too was
  280. on the desktop, it was not an alias, and its application was on another
  281. volume. Although it kept its icon, 7.0.1 said it could not find the application
  282. to launch (microphoneII v3.0.1). Stomped on this one by opening the
  283. document from within microphone and resaving the document over the original.
  284. NOTE, restarting the application and quitting did not fix this info-loss.
  285.  
  286. I presume both problems have something to do with desktop file rebuilding
  287. and some subsequent information loss. Ideas anyone.
  288.  
  289. - --alen
  290. alen@crash.cts.com
  291.  
  292. ps what is the official apple doc for programming drag-and-drop features?
  293.    I've done this stuff by guesswork and resedit investigations, I have
  294.    inside-mac 1->5, I'll go look at the bookstore to see if apple has
  295.    produced any more.
  296.  
  297. pps I'm on a mac SE/30, system 7.0.1, tuneup 1.1.1, no VM, many inits.
  298.  
  299. +++++++++++++++++++++++++++
  300.  
  301. From: colin@Cayman.COM (Colin "Atilla" Steele)
  302. Date: 11 May 92 19:01:24 GMT
  303. Organization: Cayman Systems Inc., Cambridge, MA
  304.  
  305.  
  306. Please post a summary of responses to this question - I'd love to hear
  307. the answers.
  308. - --
  309.  
  310.  
  311. - ------------------------------------------------------------------------------
  312.  Colin Steele     | Cayman Systems, 26 Landsdowne St., Cambridge, MA 02139
  313.  colin@cayman.com | (617) 494-1916 x209 | applelink D0523 | Fax (617) 494-9270
  314.  
  315. ---------------------------
  316.  
  317. From: shaner@excite.educ.sfu.ca   (Shane Rosborough)
  318. Subject: A few questions . . .
  319. Organization: Simon Fraser University, Burnaby, B.C., Canada
  320. Date: Fri, 8 May 1992 18:55:28 GMT
  321.  
  322.  
  323. I have a few questions for all you Mac Pascal gurus out there....
  324.  
  325. [1]   What is the "accepted" or "best" method for doing simple animations,
  326.     ie. moving an object (pict, or is there a better object to use?) across
  327.     the screen, and in a selected pattern?
  328.  
  329. [2]   What is the procedure for displaying a QUICKTIME movie in a window?
  330.  
  331. [3]   Is there a way to "lock the screen"?  When making a window containing a  
  332. pict, when the screen background is black, the window creates a white box  
  333. before loading in the picture.
  334.  
  335. Any help on those three questions would be appreciated...
  336.  
  337. An email response would be valued as I often don't have time to read/scan thru  
  338. all the new posts to this group.
  339.  
  340. SR.
  341. - -------------------------------------------------------------------------------
  342. Shane Rosborough                          shaner@excite.educ.sfu.ca
  343. Student/Employee    Have a G'day eh?!    TEx@mozart.educ.sfu.ca
  344. Simon Fraser Univ.                rosborou@mailserver.sfu.ca
  345.  
  346.  
  347.  
  348. +++++++++++++++++++++++++++
  349.  
  350. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  351. Organization: Kalamazoo College
  352. Date: Sun, 10 May 1992 05:59:51 GMT
  353.  
  354. shaner@excite.educ.sfu.ca (Shane Rosborough) writes:
  355. >
  356. >[3]   Is there a way to "lock the screen"?  When making a window containing a  
  357. >pict, when the screen background is black, the window creates a white box  
  358. >before loading in the picture.
  359.  
  360. I believe that, if you set up the 'wctb' correctly, the window's first
  361. drawing will come out correctly.  Could someone confirm or deny this?
  362.  
  363. >An email response would be valued as I often don't have time to read/scan
  364. >thru all the new posts to this group.
  365.  
  366. I'm forwarding this to Shane, but wanted to give y'all a chance to prove
  367. me wrong in the meantime...  :-)
  368. - -- 
  369.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  370.  "Also thanks to:  Inside Macintosh (except vol. V, ch. 27)"
  371.    - the Tesserae "About..." box
  372.  
  373. +++++++++++++++++++++++++++
  374.  
  375. From: shaner@excite.educ.sfu.ca (Shane Rosborough)
  376. Date: 10 May 92 20:53:08 GMT
  377. Organization: Simon Fraser University, Burnaby, B.C., Canada
  378.  
  379. In article <1992May10.055951.3617@hobbes.kzoo.edu> k044477@hobbes.kzoo.edu  
  380. (Jamie R. McCarthy) writes:
  381.  
  382. > I believe that, if you set up the 'wctb' correctly, the window's first
  383. > drawing will come out correctly.  Could someone confirm or deny this?
  384.  
  385. That brings up another question.  the wctb, I know how to open a pict file, but  
  386. I've haven't seen any information on using a wctb (by the way, I'm IM-less, I  
  387. don't have any of the volumes, so that's probably a big problem.)  Any info on  
  388. how to encorporate a wctb into my pict loading would be a help...
  389.  
  390.  
  391. - -------------------------------------------------------------------------------
  392. Shane Rosborough                          shaner@excite.educ.sfu.ca
  393. Student/Employee    Have a G'day eh?!    TEx@mozart.educ.sfu.ca
  394. Simon Fraser Univ.                rosborou@mailserver.sfu.ca
  395.  
  396. +++++++++++++++++++++++++++
  397.  
  398. From: mlanett@void.ncsa.uiuc.edu (Mark Lanett)
  399. Date: 11 May 92 00:39:44 GMT
  400. Organization: University of Illinois at Urbana
  401.  
  402. shaner@excite.educ.sfu.ca (Shane Rosborough) writes:
  403.  
  404. >That brings up another question. the wctb, I know how to open a pict file, but
  405. >I've haven't seen any information on using a wctb (by the way, I'm IM-less, I  
  406. >don't have any of the volumes, so that's probably a big problem.)  Any info on
  407. >how to encorporate a wctb into my pict loading would be a help...
  408.  
  409. If you don't have IM, go fetch the HyperCard version from Apple's ftp server.
  410. You can't do any Toolbox stuff w/o it. It's in /dts/mac/docs/stacks/spinside
  411. (ftp.apple.com). In fact, if you have the disk space (and MPW), I'd fetch
  412. 411 also.
  413. - -- 
  414. Mark Lanett, NCSA Software Development - mlanett@uiuc.edu
  415.  
  416. ---------------------------
  417.  
  418. From: brownc@p4.cs.man.ac.uk (S91)
  419. Subject: mac programming reference books - any recommendations?
  420. Date: 8 May 92 11:22:08 GMT
  421.  
  422.  
  423. Hi netters!
  424.  
  425. I'm quite new to macintosh programming - i've done a bit of pascal on other platforms, but very little for a windowing system (SRGP in UNIX)
  426.  
  427. I obviously need to buy some reference books which would give details of toolbox routines and techniques and hints for using them - sample code would be helpful.
  428.  
  429. I am particularly interested in learning about appleevents and appletalk programming, but would need general reference material too.
  430.  
  431. I'm working with a very limited budget (which is why i havn't gone out and bought the Inside Mac series)
  432.  
  433. Books i've considered are: Inside Mac I-VI
  434.                Macintosh Revealed (I have Vol 2)
  435.  
  436. Which Inside Mac volumes are:
  437.  
  438.     1) Essential
  439.     2) Useful
  440.     3) Redundant
  441.  
  442. (programming for IIsi upwards, using Sys 7)
  443.  
  444. Thanks in advance for your help
  445.  
  446. Chris Brown
  447.  
  448. +++++++++++++++++++++++++++
  449.  
  450. From: edw@caligula.cts.com (Ed Watkeys)
  451. Date: 9 May 92 13:14:50 GMT
  452. Organization: Distant Software
  453.  
  454.  
  455. In article <brownc.705324128@p4.cs.man.ac.uk> (comp.sys.mac.programmer), brownc@p4.cs.man.ac.uk (S91) writes:
  456. > Which Inside Mac volumes are:
  457. >     1) Essential
  458. >     2) Useful
  459. >     3) Redundant
  460. > (programming for IIsi upwards, using Sys 7)
  461. > Thanks in advance for your help
  462. > Chris Brown
  463. I.   Essential -- even though it's ancient, most of it still applies.
  464. II.  Essential, but a bit less so... (the File Manager's here...)
  465. III. Don't bother. (I don't think I've ever even looked at it...)
  466. IV.  Helpful. Talks about HFS and some other Mac Plus stuff.
  467. V.   Essential/Helpful. Essential if you want to do color. Helpful otherwise.
  468. VI.  Essential. This is my opinion. If you don't like Sys 7, don't get it...
  469.  
  470. In addition to this I'd suggest you get THINK Reference. While it's currently
  471. only current with IM V, I talked to Symantec and they implied that it would
  472. be updated for System 7 eventually. It's really handy for programming (my
  473. knees have gotten all messed up from crossing my legs and putting IM VI and
  474. I on them... but no more!).
  475.  
  476. Ed
  477.  
  478. - --
  479. Ed Watkeys (Drexel U. Comp Sci)  "Moral judgement and condemnation is
  480. edw@caligula.cts.com              the favorite form of revenge for the
  481. edw%caligula@phlpa.pha.pa.us      spiritually limited on those who are
  482. ls.com!phlpa!caligula!edw         less so...." -- Friedrich Nietzsche
  483.  
  484. ---------------------------
  485.  
  486. From: kad@rocky.den.mmc.com (Kurt DeShazer)
  487. Subject: MPW Jump Table Size Limit
  488. Organization: Martin Marietta Astronautics, Denver
  489. Date: Fri, 8 May 1992 22:19:21 GMT
  490.  
  491.      I am a new user of MPW C, and am finding linking to be a little tough.  I
  492. have created a library with the LIB command. Then while I link my library into
  493. my main program, I am getting the following error:
  494.  
  495. ### LINK: ERROR: Jump table offset into code segment is greater than 32K.
  496.  (ERROR 50) <My_Routine>.
  497.  
  498. Where <My_Routine> is the name of an external routine used either in my code, or 
  499. in one of the comercial libraries that I am linking to.  This error shows up for many bu not all external routines.  The MPW manul suggest a -ss option that will
  500. allow segments that are greater than 32K, but when I use this option, I get the
  501. following message"-ss is obsolete. There are no segment size limitations",
  502. followed by a list of the same error messages shown above.
  503.  
  504.  
  505. Has anyone ever tried to reach APDA tech support.  Apple gave me the biggest
  506. runaround that I have ever experienced! :-(
  507.  
  508.  
  509. Kurt DeShazer
  510. kad@omni.den.mmc.com
  511.  
  512.  
  513. +++++++++++++++++++++++++++
  514.  
  515. From: mlanett@void.ncsa.uiuc.edu (Mark Lanett)
  516. Organization: University of Illinois at Urbana
  517. Date: Sat, 9 May 1992 11:02:11 GMT
  518.  
  519. kad@rocky.den.mmc.com (Kurt DeShazer) writes:
  520.  
  521. >     I am a new user of MPW C, and am finding linking to be a little tough.  I
  522. >have created a library with the LIB command. Then while I link my library into
  523. >my main program, I am getting the following error:
  524.  
  525. >### LINK: ERROR: Jump table offset into code segment is greater than 32K.
  526. > (ERROR 50) <My_Routine>.
  527.  
  528. Try using (linker options) -l (or -la or -lf or -map) to figure out which
  529. segment is overflowing. Then segment your code again and move stuff out of
  530. there (scatter '#pragma segment <segment>' calls through the code).
  531.  
  532. - -wrap is a potential solution; so is model far (compile and link with the model
  533. far options on).
  534. - -- 
  535. Mark Lanett, NCSA Software Development - mlanett@uiuc.edu
  536.  
  537. ---------------------------
  538.  
  539. From: pittenger-laurence@CS.YALE.EDU (Laurence Arthur Pittenger)
  540. Subject: HELP!  Handle woes
  541. Organization: Yale University Computer Science Dept., New Haven, CT 06520-2158
  542. Date: Sat, 9 May 1992 05:37:55 GMT
  543.  
  544. I have a utility routine to check if a handle is pointing to a certain
  545. structure.  It does this by the straightforward call:
  546.  
  547. Boolean okHandle = (GetHandleSize(h) == sizeof (myStructure));
  548.  
  549. But sometimes GetHandleSize(h) will give a bus error, for instance
  550. when it is garbage and doubly dereferencing it (**h) yields a bus
  551. error.
  552.  
  553. [note: oddly, even though (*h) gives an acceptable, albeit garbage,
  554. value, GetPtrSize((Ptr)h) also gives a bus error.  Why?]
  555.  
  556. All the handle-related memory routines seem to have the same problem.
  557. How do I check the value of h to make sure that it is such that it
  558. won't crash my program if I call GetHandleSize?
  559.  
  560. Surely there must be a way to do this -- it is very basic programming
  561. protocol to have a check function for one's structures, and even the
  562. Mac interface programmers couldn't have been so irresponsible so as to
  563. leave out such a check function for Handles, could they?...
  564.  
  565. [don't flame me if this is somewhere in I.M. -- I don't have my
  566. manuals here.  I did check the Hypercard version of I.M., but no luck
  567. there.]
  568.  
  569. thanks in advance,
  570. LP
  571. - -- 
  572.  
  573. Laurence A. Pittenger
  574. CSNET  : pittenger-laurence@cs.yale.edu
  575. BITNET : pitlaua@yalevm ,  pittenger-laurence@yalecs
  576.  
  577. +++++++++++++++++++++++++++
  578.  
  579. From: mhall@occs.cs.oberlin.edu (Matthew Hall)
  580. Organization: Oberlin College Computer Science
  581. Date: Sat, 9 May 1992 20:05:50 GMT
  582.  
  583. In article <1992May9.053755.22858@cs.yale.edu> pittenger-laurence@CS.YALE.EDU (Laurence Arthur Pittenger) writes:
  584.  
  585. >   I have a utility routine to check if a handle is pointing to a certain
  586. >   structure.  It does this by the straightforward call:
  587. >
  588. >   Boolean okHandle = (GetHandleSize(h) == sizeof (myStructure));
  589. >
  590. >   But sometimes GetHandleSize(h) will give a bus error, for instance
  591. >   when it is garbage and doubly dereferencing it (**h) yields a bus
  592. >   error.
  593. >
  594. >   [note: oddly, even though (*h) gives an acceptable, albeit garbage,
  595. >   value, GetPtrSize((Ptr)h) also gives a bus error.  Why?]
  596. >
  597. >   All the handle-related memory routines seem to have the same problem.
  598. >   How do I check the value of h to make sure that it is such that it
  599. >   won't crash my program if I call GetHandleSize?
  600.  
  601. The size of the handle is stored in a header block to the data.  The
  602. handle itself contains the address of a pointer to the data. The
  603. header is something like the 12 bytes before tha data.  There is also
  604. all sorts of other information there.  When you GetHandleSize, the mac
  605. reads the block header.  If your handle is garbage, likely it points
  606. to an address way out of range of your memory (unless you have 4 gig)
  607. and trying to read that creates a bus error.  
  608. If you try to read a nil handle, this will usually happen as well,
  609. since most development environments or debuggers set the value at
  610. 0000000 to one that will assuredly cause a bus error, (TMON sets it to
  611. 'NIL!').  
  612. So, what to do?  Make sure that if your handle is not valid, that it
  613. points to NIL - set them all at startup, and set each handle to nil
  614. after disposing them.  then in your check function, first check to see
  615. if the handle points to nil.  If it does, DON'T use gethandle size,
  616. but return false. Makes code a little messier, but also makes it work.
  617.  
  618. hope this halps
  619. - -matt hall
  620.  
  621. - --
  622.  
  623.  
  624. - -------------------------------------------------------------------------------
  625. Matt Hall.    mhall@occs.cs.edu  OR  SMH9666@OBERLIN.BITNET
  626.               (216)-775-5805 (That's a Cleveland Area code. Lucky Me)
  627.  
  628. "If a man comes up to you and says:
  629.     'A dog just carried away your ear.'
  630. Do you run after the dog, or search first for your ear?" - Moon over Morocco
  631.   
  632.  
  633. +++++++++++++++++++++++++++
  634.  
  635. From: scott@mcl.mcl.ucsb.edu (Scott Bronson)
  636. Date: 10 May 92 02:09:17 GMT
  637.  
  638. In <MHALL.92May9150550@occs.cs.oberlin.edu> mhall@occs.cs.oberlin.edu (Matthew Hall) writes:
  639.  
  640. >So, what to do?  Make sure that if your handle is not valid, that it
  641. >points to NIL - set them all at startup, and set each handle to nil
  642. >after disposing them.  then in your check function, first check to see
  643. >if the handle points to nil.  If it does, DON'T use gethandle size,
  644. >but return false. Makes code a little messier, but also makes it work.
  645.  
  646.  
  647. THINK has some utility routines in their class library to solve problems
  648. very much like these.  I find them very handy and include my own equivalents
  649. in all of my projects.  I'm at school now, so I can't verify these macros
  650. (they're just off the top of my head).  It shouldn't be too hard to get the
  651. general idea, though.
  652.  
  653. #include "StdSyntaxDisclaimer"
  654.  
  655. #define ForgetHandle(h) DisposeHandle(h);h=0
  656. #define ForgetFile(f)   Close(f);f=0
  657. ...
  658.  
  659. So, you'll never accidentally get good data from a released handle or
  660. related memory problems (you'll always bus error if you're using
  661. Mr._Bus_Error or debugger that does the same thing).  Note that if
  662. you try to close a file using an invalid nonzero file reference number,
  663. you could corrupt other files.  These macros solve all that.
  664.  
  665.     - Scott
  666.  
  667. +++++++++++++++++++++++++++
  668.  
  669. From: cstrockb@cs.sunysb.edu (Caleb Strockbine)
  670. Date: 11 May 92 03:17:57 GMT
  671. Organization: SUNY at Stony Brook Computer Science Dept.
  672.  
  673.  
  674. In article <scott.705463757@mcl> scott@mcl.mcl.ucsb.edu (Scott Bronson) writes:
  675.  
  676.    In <MHALL.92May9150550@occs.cs.oberlin.edu> mhall@occs.cs.oberlin.edu (Matthew Hall) writes:
  677.  
  678.    >So, what to do?  Make sure that if your handle is not valid, that it
  679.    >points to NIL - set them all at startup, and set each handle to nil
  680.    >after disposing them.  then in your check function, first check to see
  681.    >if the handle points to nil.  If it does, DON'T use gethandle size,
  682.    >but return false. Makes code a little messier, but also makes it work.
  683.  
  684. Tech Note #51 seems to address this problem too. It suggests a nifty way
  685. to find problems of this sort using calls to PurgeMem() and then
  686. CompactMem(). Basically, you do something like:
  687.  
  688. long MaxSize = 0x800000;
  689.  
  690. PurgeMem(MaxSize);
  691. size = CompactMem(MaxSize);
  692.  
  693. As the note explains, including these lines in your event loop is sure
  694. to shake things up in memory so that you find errors like dereferencing
  695. unlocked handles or invalid pointers "very quickly." Also makes your
  696. app slow as molasses, but that's OK for debugging purposes.
  697.  
  698. Check out the note.
  699.  
  700. Caleb Strockbine
  701. cstrockb@ic.sunysb.edu
  702.  
  703. Flames via e-mail, please.
  704.  
  705. ---------------------------
  706.  
  707. From: edw@caligula.cts.com (Ed Watkeys)
  708. Subject: Totally moronic question concerning color
  709. Date: Sat, 9 May 92 00:34:17 EDT
  710. Organization: Distant Software
  711.  
  712. OK, I'd like to know how to do the following:
  713.  
  714. I have two RGBColor variables, foreColor and backColor. I would like to set
  715. the content area of a window to backColor (or the closest match) and set the
  716. pen to foreColor (or the closest match). Currently, I am attempting to do
  717. this pretty much like this (in Pascal...)
  718.  
  719.   testWindow := GetNewCWindow(128, nil, WindowPtr(-1));
  720.   SetPort(testWindow);
  721.   aColor.red := 70;
  722.   aColor.green := 70;
  723.   aColor.blue := 70;
  724.   RGBBackColor(aColor);
  725.   aColor.red := 200;
  726.   aColor.green := 200;
  727.   aColor.blue := 200;
  728.   RGBForeColor(aColor);
  729.   GetFNum('Monaco', fontNum);
  730.   TextFont(fontNum);
  731.   TextSize(9);
  732.   ...
  733.   SizeWindow(testWindow, pixelWidth, pixelHeight, false);
  734.   ShowWindow(testWindow);
  735.   MoveTo(5, fontHeight + 13);
  736.   Line(pixelWidth - 10, 0);
  737.  
  738. Can I use GetNewCWindow without a wctb? I'm very confused about this color
  739. stuff. Respond via email or news; I keep up to date...
  740.  
  741. Ed
  742.  
  743. - --
  744. Ed Watkeys (Drexel U. Comp Sci)  "Moral judgement and condemnation is
  745. edw@caligula.cts.com              the favorite form of revenge for the
  746. edw%caligula@phlpa.pha.pa.us      spiritually limited on those who are
  747. ls.com!phlpa!caligula!edw         less so...." -- Friedrich Nietzsche
  748.  
  749. +++++++++++++++++++++++++++
  750.  
  751. From: edw@caligula.cts.com (Ed Watkeys)
  752. Date: 9 May 92 13:28:07 GMT
  753. Organization: Distant Software
  754.  
  755.  
  756. In article <01050133.31jk85@caligula.cts.com> (comp.sys.mac.programmer), edw@caligula.cts.com (Ed Watkeys) writes:
  757. > OK, I'd like to know how to do the following:
  758. > I have two RGBColor variables, foreColor and backColor. I would like to set
  759. > the content area of a window to backColor (or the closest match) and set the
  760. > pen to foreColor (or the closest match). Currently, I am attempting to do
  761. > this pretty much like this (in Pascal...)
  762. >   testWindow := GetNewCWindow(128, nil, WindowPtr(-1));
  763. >   SetPort(testWindow);
  764. >   aColor.red := 70;
  765. >   aColor.green := 70;
  766. >   aColor.blue := 70;
  767. >   RGBBackColor(aColor);
  768. >   aColor.red := 200;
  769. >   aColor.green := 200;
  770. >   aColor.blue := 200;
  771. >   RGBForeColor(aColor);
  772. >   GetFNum('Monaco', fontNum);
  773. >   TextFont(fontNum);
  774. >   TextSize(9);
  775. >   ...
  776. >   SizeWindow(testWindow, pixelWidth, pixelHeight, false);
  777. >   ShowWindow(testWindow);
  778. >   MoveTo(5, fontHeight + 13);
  779. >   Line(pixelWidth - 10, 0);
  780. > Can I use GetNewCWindow without a wctb? I'm very confused about this color
  781. > stuff. Respond via email or news; I keep up to date...
  782. > Ed
  783.  
  784. And totally morinic I was... The color I specified for the foreground color
  785. was essentially black once it went throught the Palette Mgr -- I didn't know
  786. that the range for each color was 0-65535. Sorry for the bandwidth...
  787.  
  788. Ed
  789.  
  790. - --
  791. Ed Watkeys (Drexel U. Comp Sci)  "Moral judgement and condemnation is
  792. edw@caligula.cts.com              the favorite form of revenge for the
  793. edw%caligula@phlpa.pha.pa.us      spiritually limited on those who are
  794. ls.com!phlpa!caligula!edw         less so...." -- Friedrich Nietzsche
  795.  
  796. ---------------------------
  797.  
  798. From: a-giles@uchicago.edu (Aaron Giles)
  799. Subject: Black windows?
  800. Organization: University of Chicago High Energy Physics
  801. Date: Mon, 11 May 1992 03:54:42 GMT
  802.  
  803.  
  804. Is there any simple way to make the default color for windows black?
  805. Right now, whenever a window has to be redrawn, the system makes it
  806. white, which I just then black out and proceed with my drawing.  It
  807. works, but it's not exactly "elegant".  The "flashing" effect I get is
  808. annoying, and I know there's got to be a way to just make it black all
  809. the time.  It would make me really happy if I could do with without
  810. having to deal with a new WDEF. :-)
  811.  
  812. Thanks in advance,
  813. Aaron
  814. - -----
  815.                      Aaron Giles -- a-giles@uchicago.edu
  816.            "You can't have everything ... where would you put it?"
  817.  
  818. +++++++++++++++++++++++++++
  819.  
  820. From: oster@well.sf.ca.us (David Phillip Oster)
  821. Date: 11 May 92 05:14:09 GMT
  822. Organization: Whole Earth 'Lectronic Link
  823.  
  824. There are a couple of things you can do to avoid the O.S. giving you an initial
  825. white window:
  826.  
  827. If it is a color machine, give ti a wctb with black as the background color.
  828.     a.) create it from a WIND resource, and give it a 'wctb' with the same
  829.         number.
  830.     b.) create it inivisible, and associate the 'wctb' before making it
  831.         visible.
  832. Inside Mac Vol 1, Window Manager chapter documents a global variable you can
  833. set immediately before making the window viisible that causes the O.S. to omit
  834. clearing the contents area to white. (The desktop just shows through until you
  835. clear it at the beginning of your update routine.)
  836.  
  837. Use a custom WDEF to make the whole window be "windowFame" then you can
  838. do what ever you want in yor wdef code.  (Remember that the WDEF won't
  839. necessarily run with the same A5 as your application under Sys 7 or multifinder.)
  840.  
  841. +++++++++++++++++++++++++++
  842.  
  843. From: news@massey.ac.nz (USENET News System)
  844. Date: Tue, 12 May 92 08:52:55 GMT
  845. Organization: School of Maths. and Info. Sci., Massey University, Palmerston North, NZ
  846.  
  847. In article <1992May11.051409.17197@well.sf.ca.us> oster@well.sf.ca.us (David Phillip Oster) writes:
  848. >If it is a color machine, give ti a wctb with black as the background color.
  849. >    a.) create it from a WIND resource, and give it a 'wctb' with the same
  850. >        number.
  851. >    b.) create it inivisible, and associate the 'wctb' before making it
  852. >        visible.
  853. >Inside Mac Vol 1, Window Manager chapter documents a global variable you can
  854. >set immediately before making the window viisible that causes the O.S. to omit
  855. >clearing the contents area to white. (The desktop just shows through until you
  856. >clear it at the beginning of your update routine.)
  857.  
  858. On a b&w or colour machine, create the window (preferably without showing it),
  859. then call BackColor(black) and show it. All erasing is then done in black
  860. instead of white, so the window goes black.
  861.  
  862. Brent
  863.  
  864.  
  865. ---------------------------
  866.  
  867. End of C.S.M.P. Digest
  868. **********************
  869.